<?php

declare(strict_types=1);

namespace App\Model;

use Hyperf\Database\Model\Relations\BelongsTo;

/**
 * @property int $id
 * @property int $device_id 设备id
 * @property int $port_bin 插孔号 1=故障
 * @property int $inline 0=离线 1=在线
 * @property int $fault_message
 * 0-未发生，1-发生
 * Bit0：过压告警 over_voltage
 * Bit1：欠压告警 under_voltage
 * Bit2：继电器粘连 relay_stick
 * Bit3：保险丝烧毁 fuse_cut-out
 * Bit4：计量异常  Metering error
 * Bit5：过温告警   over_temp
 * Bit6：漏电告警   leakage_alarm
 * Bit7：充电器故障 charger_error
 * Bit8：气溶胶触发 aerosol_trigger
 * Bit9：接地故障
 * Bit10:短路
 * Bit11:CP故障
 * Bit12：过流
 */
class DevicePortErrLog extends Model
{
    protected ?string $table = 'device_port_err_log';

    const STATUS = ['handle_yes' => 1, 'handle_no' => 0];

    /**所属设备
     * @return BelongsTo
     */
    public function device(): BelongsTo
    {
        return $this->belongsTo(Device::class, 'device_id', 'id');
    }
}
